Skip to content

CheckoutSessions — PMO SFU#6353

Merged
gbirch-stripe merged 9 commits intomasterfrom
gbirch/cs-pr3-pmo-sfu
Apr 21, 2026
Merged

CheckoutSessions — PMO SFU#6353
gbirch-stripe merged 9 commits intomasterfrom
gbirch/cs-pr3-pmo-sfu

Conversation

@gbirch-stripe
Copy link
Copy Markdown
Collaborator

Summary

Add PMO SFU support to CheckoutSessions
Note for testing: many payment methods have different PMO SFU options available as compared to Payment Intents

Motivation

https://docs.google.com/document/d/1CWglcOHR6I8cOWKjztPfnhnVG8axucpv-j5cWIoey7E/edit?pli=1&tab=t.g4karprubz63

Testing

  • unit tests
  • manual testing in playground

Changelog

gbirch-stripe and others added 4 commits April 16, 2026 15:02
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@gbirch-stripe gbirch-stripe requested review from a team as code owners April 17, 2026 04:01
Copy link
Copy Markdown
Collaborator

@porter-stripe porter-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few comments

return !setupFutureUsageValues.isEmpty
}
return nil
case .checkoutSession:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to line 133 here, can't select it.

For payment mode, it returns the top-level setupFutureUsage only. The setupFutureUsageString property is used in analytics. Is it intentional that this reports only the top-level value? I think this is consistent with others but just want to double check.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I intentionally made it only report the top-level to align with intent flows

waitForExpectations(timeout: 10)
}

func testCheckoutSessionConfirmWithNonCardPaymentMethodIncludesSavePaymentMethod() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this PR are quite light considering what it's adding. Let's add PaymentSheetLPMConfirmFlowTests coverage: we already test PMO+SFU paymentIntentWithPMOSetupFutureUsagefor PI/deferred PI, but that suite doesn't test CheckoutSession+PMO SFU


extension STPCheckoutSession {
var isPaymentMethodOptionsSetupFutureUsageSet: Bool {
return !setupFutureUsageForPaymentMethodType.isEmpty
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit/question: The existing STPPaymentMethodOptions.isSetupFutureUsageSet (line 45-52 of STPPaymentMethodOptions.swift) checks whether any PMO entry contains the key setup_future_usage. Might be a bit safer to align with STPPaymentMethodOptions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting that we use the payment_method_options property on the checkout session as the data source for PMO SFU rather than setup_future_usage_for_payment_method_type or something else? If the former, I have a question about which to use down in the API team questions list, but for now my intuition is to use the setup_future_usage_for_payment_method_type property since it is specific to checkout sessions and what is used by web: https://stripe.sourcegraphcloud.com/deepsearch/c4c1b6ed-ecad-4140-a808-600a15fa1da9#answer-169850

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 18, 2026

⚠️ New dead code detected in this PR but ignored:

STPTestingAPIClient+Swift.swift:198 warning: Unused function 'checkoutSessionAdditionalParameters(currency:amount:setupFutureUsage:paymentMethodOptionsSetupFutureUsage:allowPromotionCodes:allowAdjustableLineItemQuantity:includeShippingOptions:collectShippingAddress:collectBillingAddress:automaticTax:enableTaxIdCollection:adaptivePricingEnabled:customerEmailLocation:)'
STPTestingAPIClient+Swift.swift:292 warning: Unused function 'fetchCheckoutSessionPaymentMode(types:currency:amount:merchantCountry:customerID:setupFutureUsage:paymentMethodOptionsSetupFutureUsage:allowPromotionCodes:allowAdjustableLineItemQuantity:includeShippingOptions:collectShippingAddress:collectBillingAddress:automaticTax:enableTaxIdCollection:adaptivePricingEnabled:customerEmailLocation:)'

This dead code check has been bypassed with the skip dead code check label.

ℹ️ If this comment appears to be left in error, double check that the flagged code is actually used and/or make sure your branch is up-to-date with master.

[find-dead-code]

@gbirch-stripe
Copy link
Copy Markdown
Collaborator Author

skipping dead code detection — fetchCheckoutSessionPaymentMode and checkoutSessionAdditionalParameters are used in testing code

@gbirch-stripe gbirch-stripe merged commit ddb0172 into master Apr 21, 2026
7 checks passed
@gbirch-stripe gbirch-stripe deleted the gbirch/cs-pr3-pmo-sfu branch April 21, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants